import { CommonService } from '../../core/common/common.service';
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FileUploadModule } from 'ng2-file-upload';
import { CloudSharedModule } from '../../shared/shared.module';
import { httpFactory } from '../../core/http/http.factory';
import { DefaultRequestOptions, requestOptionsProvider } from '../../core/http/default-request-options.service';
import { LocalXSRFStrategy } from '../../core/http/local-xsrf-strategy.service';
import { Http, XSRFStrategy, XHRBackend, RequestOptions } from '@angular/http';
import { ConfigService } from '../../core/common/config.service';
import { TableDictService } from '../../core/common/table-dict.service';
import { FileUploadPrimeNG } from '../../core/common/upload-primeng.component';
import { UploadComponent } from '../../core/common/upload.component';
import { Router } from '@angular/router';
import { CustomFormsModule } from 'ng2-validation';
import { FormsModule } from '@angular/forms';
import { ISPComponent } from './component/isp/isp.component';
import { NodeComponent } from './component/node/node.component';
import { CustomerComponent } from './component/customer/customer.component';
import { FeeComponent } from './component/fee/fee.component';
import { FeeShowComponent } from './component/fee/feeShow.component';
import { ForbiddenValidatorDirective } from './component/node/forbidden-name.directive';
import { NodeCellComponent } from './component/node/node-cell.component';
import { NodeCellCloudComponent } from './component/node/node-cloud/node-cloud.component';
import { NodeCellSDWANComponent } from './component/node/node-sdwan/node-sdwan.component';
import { ProductComponent } from './component/product/product.component';
import { MyCust } from './mycust/mycust';
import { MyorderComponent } from './myorder/myorder.component';
import { OrderqueryComponent } from './orderquery/orderquery.component';
import { Sale } from './sale/sale';
import { CustomerService } from './service/customer.service';
import { ProductService } from './service/product.service';
import { NodeCellStateComponent } from './component/node/node-state/node-state.component';
const routes: Routes = [
  { path: '', redirectTo: 'crm' },
  { path: 'sale', component: Sale },
  { path: 'mycust', component: MyCust },
  { path: 'product', component: ProductComponent },
  { path: 'orderquery', component: OrderqueryComponent },
  { path: 'myorder', component: MyorderComponent },
];
@NgModule({
  imports: [
    CloudSharedModule,
    FileUploadModule,
    CustomFormsModule,
    FormsModule,
    RouterModule.forChild(routes)
  ],
  declarations: [
    FeeShowComponent, FileUploadPrimeNG, NodeCellCloudComponent, NodeCellSDWANComponent, Sale, ProductComponent, UploadComponent,
    FeeComponent, MyorderComponent, OrderqueryComponent, NodeCellComponent, CustomerComponent, NodeComponent,
    ISPComponent, ForbiddenValidatorDirective, MyCust, NodeCellStateComponent
  ],
  exports: [
    RouterModule,
  ],
  providers: [ProductService, CustomerService, CommonService, ConfigService, requestOptionsProvider, TableDictService,
    DefaultRequestOptions,
    {
      provide: XSRFStrategy, useClass: LocalXSRFStrategy,
    },
    {
      provide: Http,
      useFactory: httpFactory,
      deps: [XHRBackend, RequestOptions, ConfigService, Router]
    }]
})
export class CrmModule { }
